﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;
using System.Diagnostics;
using Microsoft.Xna.Framework;

namespace SceneManager.Processors
{
    public abstract class Processor
    {
        public Game Game { get; private set; }
        public Dictionary<string, RenderTarget2D> Outputs { get; private set; }

        public int Width
        {
            get
            {
                return Game.GraphicsDevice.PresentationParameters.BackBufferWidth;
            }
        }
        public int Height
        {
            get
            {
                return Game.GraphicsDevice.PresentationParameters.BackBufferHeight;
            }
        }

        public double ProcessTime
        {
            get
            {
                return processTimes.Count == 0 ? -1 : processTimes.Average();
            }
        }
        protected Queue<int> processTimes;

        protected Stopwatch stopwatch;

        public Processor(Game game)
        {
            Game = game;
            Outputs = new Dictionary<string, RenderTarget2D>();
            processTimes = new Queue<int>();

#if DEBUG
            stopwatch = new Stopwatch();
#endif
        }

        public abstract void Process(Camera camera, GameTime gameTime);
    }
}
